package regexobject;

public class ExtandString {
    public static void main(String[] args) {
        String path = "http://localhost:8088/myweb/reg?name=zhangsan&pwd=123456&nick=san&age=16";

        String[] str=path.split("\\?");
        String[] str2=str[1].split("&");
        for (int i=0;i<str2.length;i++){
            String[] str3=str2[i].split("=");

            System.out.print("参数名:"+str3[0]+"\t");
            System.out.println("参数值："+str3[1]);

        }
        System.out.println("-----------------------------");
        int index=path.indexOf("?");
        String pathSub=path.substring(index+1);
        String[] st4=pathSub.split("&");
        for (int i=0;i<st4.length;i++){
            String[] str5=st4[i].split("=");

            System.out.print("参数名:"+str5[0]+"\t");
            System.out.println("参数值："+str5[1]);

        }
    }

}
